import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import viteSvgIcons from 'vite-plugin-svg-icons';
import styleImport from 'vite-plugin-style-import';
const {resolve} = require('path')
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    styleImport({
      libs: [{
        libraryName: 'element-plus',
        esModule: true,
        ensureStyleFile: true,
        resolveStyle: (name) => {
          name = name.slice(3)
          return `element-plus/packages/theme-chalk/src/${name}.scss`;
        },
        resolveComponent: (name) => {
          return `element-plus/lib/${name}`;
        },
      }]
    }),
    viteSvgIcons(
      {
        iconDirs:[resolve(process.cwd(),'src/icons/svg')],
        symbolId:'icon-[dir]-[name]'
      }
    )
  ],
  server:{
    port:4001
  },
  resolve:{
    alias: {
      '@': resolve(__dirname, './src')
    }
  }
  
})
